<extend name="Base/base" />
<block name='head'>
    <meta charset="utf-8">
    <link href="/Public/static/dropload/dropload.css" rel="stylesheet" />
    <!--<link href="/Public/Index/css/page.css" rel="stylesheet" />-->
    <link href="/Public/Index/css/workflow.css" rel="stylesheet" /> 
    <style>
    </style>
</block>
<block name="content" > 
    <form id="myform">
        <div class="bd">
            <div class="trip_title">
                <h2>计划查询</h2>
            </div>
            <div class="work_cells trip_next">
                <p class="top"></p>
                <table>
                    <tr>
                        <td class="key">计划名称</td>
                        <td class="text_value"><input type='text' name='name'></td>
                    </tr>
                    <tr>
                        <td class="key">负责人</td>
                        <td class="text_value"><input type='text' name='manager'></td>
                    </tr>
                    <tr>
                        <td class="key">参与人</td>
                        <td class="text_value"><input type='text' name='participator'></td>
                    </tr>
                    <tr>
                        <td class="key">计划类型</td>
                        <td class="text_value">
                            <select class="pointer" name="type">
                                <option value="0">全部</option>
                                <foreach name='types' item='type'>
                                    <option value='{$type.type_id}'>{$type.type_name}</option>
                                </foreach>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">计划状态</td>
                        <td class="text_value">
                            <select class="pointer" name="sms_flag" id="type_id">
                                <option value="0">进行中</option>
                                <option value="1">已结束</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">开始时间</td>
                        <td class="text_value">
                            <input type="text" style='border:1px solid #CFDDEA;width:35%;' name="start" id="start" class="date dateTime" placeholder="双击打开日历">&nbsp;至&nbsp;
                            <input type="text" style='border:1px solid #CFDDEA;width:35%;' name="end" id="end" class="date dateTime" placeholder="双击打开日历">

                        </td>
                    </tr>
                </table>
            </div>
            <div class="button" style="margin-left:23%;margin-top:0px;margin-bottom:0px;">
                <span>
                    <a class="pointer search" data-verify="all" style="background: #ED8D76" data-url="{:U('search')}">查询</a>
                    <a class="pointer restart" data-verify="all" style="background: #5FC6C6">重置</a>
                    共<a id="total">0</a>条
                </span>
            </div>
        </div>
    </form>

    <div class="transferred_table">
        <!--<div class="page">{$pages}</div>-->

    </div>
    <input type="hidden" id="url" value="{:U('droploadPlan')}">
    <input type='hidden' id='data' value='' />
<!--    <div class="button">
        <a class="am-btn back" data-url="{:U('index')}">返 回</a>
    </div>-->

</block>
<block name="script">
    <script type="text/javascript" src="/Public/static/dropload/dropload.js" ></script>
    <script type="text/javascript" src="/Public/Index/js/plan.js"></script>
    <script type="text/javascript" src="/Public/Index/js/planNew.js"></script>
    <script type="text/javascript">
        $('.back').on('click', function () {
            location.href = $(this).attr('data-url')
        })
        $(dateTime(0));
        $(initSchedule())

        $(function () {
            p = 2;
            var dropload = $('.transferred_table').dropload({
                scrollArea: window,
                domDown: {
                    domClass: 'dropload-down',
                    domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
                    domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                    domNoData: '<div class="dropload-noData">已无数据</div>'
                },
                loadDownFn: function (me) {
                    var url = $('#url').val() + '?p=' + p;
                    p++;
                    $.ajax({
                        url: url,
                        type: 'get',
                        success: function (res) {
                            console.log(res);
                            if (res.lists.length > 0) {
                                if (res.lists) {
                                    var html = '';
                                    for (var i = 0; i < res.lists.length; i++) {
                                        html += '<tr><td width="60%"><a href="/index.php/Index/Plan/show/id/' + res.lists[i].plan_id + '">' + res.lists[i].name + '</a></td>';
                                        html += '<td>'+res.lists[i].total_percent+'</td>';
//                                        html += '<td>' + res.lists[i].status + '</a></td>';
                                        html += '<td>';
                                        if (res.lists[i].sms_flag == 0) {
                                            html += '<a href="/index.php/Index/Plan/schedule/id/' + res.lists[i].plan_id + '">写进度</a><br/>';
                                        }
                                        if (res.lists[i].publish == 0) {
                                            html += '<a class="pointer">提交</a>';
                                        } else {
                                            html += '<a class="comment pointer" data-id="' + res.lists[i].plan_id + '">批注</a>';
                                        }
                                        html += '</td></tr>';
                                    }

                                } else {
                                    html += '<tr><td colspan="5" style="text-align: left">暂无数据</td></tr>'
                                }
                                $('.transferred_table table tbody tr:last').after(html);
                            } else {
                                me.noData();
                            }
                            me.resetload();
                        }
                    })
                }
            });
        })

    </script>
</block>
